import { createConnection } from 'mysql';

export default async function (host: string, user: string, password: string, database: string) {
	return new Promise<any>((resolve, reject) => {
		try {
			const connection = createConnection({
				host,
				user,
				password,
				database
			});
			connection.connect();
			resolve(connection);

		} catch (error) {
			reject(false);
		}
	});
}